/**
 *
 */
package japavo.gui.components.file_chooser;

import japavo.tools.IconFactory;

import javax.swing.JOptionPane;

/**
 *
 */
@SuppressWarnings("serial")
public class SaveFileChooser extends AbstractFileChooser {

	public SaveFileChooser(FileType type, String title) {
		super(type, title);
	}

	@Override
    public void approveSelection() {
		if (getSelectedFile().exists()) {
			int result = JOptionPane.showConfirmDialog(this,
					System.getProperty("DIALOG_SAVE_CONFIRM_OVERWRITER"),
					System.getProperty("DIALOG_SAVE_CONFIRM_OVERWRITER_HEADER"),
					JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE,
					IconFactory.getIcon(IconFactory.IconType.WARNING));
			if (result != JOptionPane.YES_OPTION) return;
		}
    	super.approveSelection();
    }

}